<?php
namespace app\common\validate;

use think\Validate;

class SectionValidate extends Validate
{
    protected $rule =   [
        'section_id|部门ID'       => 'require|number',
        'name|名称'               => 'require|length:2,20',
        'serial_no|编号'          => 'require|length:2',
        'salary_type_id|工资类型' => 'require',
        'attendance|全勤'         => 'require',
        'meal|餐补'               => 'require',
        'traffic|交通补助'        => 'require',
        'telephone|话补'          => 'require',
        'cate_id|部门分类'        => 'require',
    ];
    
    protected $scene = [
        /** admin */
        'add'    => ['name', 'serial_no', 'salary_type_id', 'attendance', 'meal', 'traffic', 'telephone', 'cate_id'],
        'edit'   => ['section_id', 'name', 'salary_type_id', 'attendance', 'meal', 'traffic', 'telephone', 'cate_id'],
    ];
}